﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>ccform傻瓜表单设计器</title>
    <link href="../../Scripts/easyUI/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../Scripts/easyUI/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <link href="../../Scripts/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/jquery-1.11.0.min.js" type="text/javascript"></script>
    <script src="../../Scripts/config.js" type="text/javascript"></script>
    <script src="../../Comm/Gener.js" type="text/javascript"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>


    <script src="../../Scripts/easyUI145/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../Scripts/EasyUIUtility.js" type="text/javascript"></script>
    <script src="../../Comm/JScript.js" type="text/javascript"></script>
    <script src="../../Scripts/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
    <script src="../../Scripts/bootstrap/BootstrapUIDialog.js" type="text/javascript"></script>
    <script src="./MapDef.js" type="text/javascript"></script>
    <script src="../../Style/Verify.js" type="text/javascript"></script>
    <script src="../../Comm/JS/Calendar/WdatePicker.js" type="text/javascript" defer="defer"></script>
    <script src="../../CCForm/FrmEnd.js" defer="defer" type="text/javascript"></script>
    <script src="../../CCForm/MapExt2019.js" defer="defer" type="text/javascript"></script>
    <script src="Designer.js" type="text/javascript"></script>

    <base target="_self" />
    <style type="text/css">
        body {
            margin: 0 auto; /*color: #000;
            line-height: 20px;
            font-family: 宋体;
            text-align: center;
            width: 90%;*/
            background-color: #f7f6f9;
            overflow: auto !important;
        }

        .wrapper-dropdown-2 {
            /* Size and position */
            position: relative; /* Enable absolute positionning for children and pseudo elements */
            width: 80px;
            margin: 0;
            border-radius: 6px;
            margin-left: 0px;
            padding: 6px 25px;
            /* Styles */
            color: white;
            cursor: pointer;
            outline: none;
        }

            .wrapper-dropdown-2:after {
                content: "";
                width: 0;
                height: 0;
                position: absolute;
                right: 16px;
                top: 50%;
                margin-top: -3px;
                border-width: 6px 6px 0 6px;
            }

            .wrapper-dropdown-2 .dropdown {
                /* Size & position */
                position: absolute;
                z-index: 100;
                top: 100%;
                margin-left: 130px;
                /* Styles */
                background: white;
                -webkit-transition: all 0.3s ease-out;
                -moz-transition: all 0.3s ease-out;
                -ms-transition: all 0.3s ease-out;
                -o-transition: all 0.3s ease-out;
                transition: all 0.3s ease-out;
                list-style: none;
                /* Hiding */
                opacity: 0;
                pointer-events: none;
            }

                .wrapper-dropdown-2 .dropdown li a {
                    position: fixed;
                    height: 29px;
                    line-height: 29px;
                    z-index: 100000;
                    margin-top: 3px;
                    padding-top: 10px;
                    list-style: none;
                    display: block;
                    padding: 9px;
                    -webkit-transition: all 0.3s ease-out;
                    -moz-transition: all 0.3s ease-out;
                    -ms-transition: all 0.3s ease-out;
                    -o-transition: all 0.3s ease-out;
                    transition: all 0.3s ease-out;
                }






            /* Active state */



            .wrapper-dropdown-2.active .dropdown {
                opacity: 1;
                pointer-events: auto;
                list-style: none;
            }

        textarea, input[type=text] {
            width: 100%;
        }

        body {
            font-size: .80em;
            font-family: "Helvetica Neue", "Lucida Grande", "Segoe UI", Arial, Helvetica, Verdana, sans-serif;
            margin: 0px;
            padding: 0px;
            color: #696969;
        }

        input.align_cb {
            padding-left: 4px;
            cursor: pointer;
            margin: 0;
            vertical-align: middle;
        }

        label.align_cbl {
            display: inline-block;
            vertical-align: middle;
            margin-bottom: 2px;
        }

        th {
            /*background-color: InfoBackground;*/
            background-color: #f1f1f1;
        }

        .cs-btn-group {
            border: 0;
            text-align: left;
        }

            .cs-btn-group a {
                margin-left: 6px;
                padding: 5px 14px;
                color: #fff;
                font-size: 13px;
                line-height: 28px;
                height: 26px;
                border: 0 none;
                border-radius: 3px;
                background-image: none;
                box-sizing: border-box;
            }

            .cs-btn-group span.l-btn-left.l-btn-left {
                padding: 0;
                background-image: none;
            }

        .btn-light-green {
            background-color: #50b6ac;
        }

            .btn-light-green:hover {
                background-color: #50b6ac;
            }

        .btn-light-blue {
            background-color: #62cae3;
        }

            .btn-light-blue:hover {
                background-color: #62cae3;
            }

        .btn-light-yellow {
            background-color: #f3ba20;
        }

            .btn-light-yellow:hover {
                background-color: #f3ba20;
            }

        .btn-light-red {
            background-color: #f74f52;
        }

            .btn-light-red:hover {
                background-color: #f74f52;
            }

        .cs-easyui-layout {
            margin: auto;
            background: #d0d0d0;
            overflow: auto;
        }

        .cs-panel-center {
            position: static;
            margin: 42px auto 0 !important;
            width: 950px !important;
            /*overflow:auto*/
        }

        .cs-panel-body {
            background-color: #fff;
            border: 0;
            border-radius: 4px;
            box-shadow: 0 0 10px rgba(0,0,0,.1);
        }

        .cs-panel-north {
            position: fixed;
            left: 0;
            right: 0;
            background-color: #F7F6F9;
            border-bottom: 1px solid #ddd;
        }

            .cs-panel-north .cs-btn-group {
                margin: auto;
                width: 1100px !important;
                background-color: #F7F6F9;
            }

        .cs-table {
            width: 100%;
        }

            .cs-table td a {
                padding-right: 0;
                color: #15398b;
                width: 24px;
                height: 24px;
                box-sizing: border-box;
            }

                .cs-table td a:hover.l-btn-plain {
                    padding: 0;
                }

        a.l-btn span span span.l-btn-empty {
            background-position: center
        }

        .cs-table th a {
            height: 30px;
            color: #282828;
            vertical-align: middle;
        }

            .cs-table th a:hover {
                padding: 0 5px 0 0;
                background-color: transparent;
                border-color: transparent;
                text-decoration: none;
            }

        .cs-table td, .cs-table th {
            line-height: 30px;
        }

        .cs-table td {
            padding: 7px;
        }

        .cs-table th {
            padding-left: 20px;
        }

        .cs-table input[type=text], .cs-table select, .cs-table textarea {
            margin: 0 !important;
            width: 100% !important;
            background-color: #fff;
        }

        .cs-table input[type="radio"], .cs-table input[type="checkbox"] {
            position: static;
            padding-left: 0;
            width: 16px !important;
            height: 16px;
            vertical-align: -4px;
        }

        .checkbox, .radio {
            margin-left: 0 !important;
        }

            .checkbox label, .radio label {
                padding-left: 0;
            }

        .cs-order {
            float: right;
            height: 30px;
        }

        .image-local {
            width: 116px;
            font-size: 16px;
            line-height: 28px;
            text-align: center;
            color: #fff;
            background-color: #0073eb;
            border: none;
            display: inline-block;
            vertical-align: middle;
            height: 28px;
            box-sizing: border-box;
            outline: none;
        }

        #state li {
            list-style: none;
            margin-top: 3px;
        }
    </style>
    <script type="text/javascript">
        //然浏览器最大化.
        function ResizeWindow() {


            if (window.screen) {  //判断浏览器是否支持window.screen判断浏览器是否支持screen
                var myw = screen.availWidth;   //定义一个myw，接受到当前全屏的宽
                var myh = screen.availHeight;  //定义一个myw，接受到当前全屏的高
                window.moveTo(0, 0);           //把window放在左上角
                window.resizeTo(myw, myh);     //把当前窗体的长宽跳转为myw和myh
            }
        }

        function WinOpen(url, name) {
            window.open(url, name, 'height=600, width=800, top=0, left=0, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no');
        }
        function TROver(ctrl) {
            ctrl.style.backgroundColor = 'LightSteelBlue';
        }

        function TROut(ctrl) {
            ctrl.style.backgroundColor = 'white';
        }
        /*隐藏与显示.*/
        function ShowHidden(ctrlID) {

            var ctrl = document.getElementById(ctrlID);
            if (ctrl.style.display == "block") {
                ctrl.style.display = 'none';
            } else {
                ctrl.style.display = 'block';
            }
        }
    </script>
    <link href="../../Comm/JS/Calendar/skin/WdatePicker.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">



        //记录改变字段样式 不可编辑，不可见
        var mapAttrs = [];
        function changeEnable(obj, FK_MapData, KeyOfEn, AtPara) {
            var selecedval = $(obj).children('option:selected').val();  //弹出select的值.
            cleanAll();
            if (AtPara.indexOf('@IsEnableJS=1') >= 0)
                setEnable(FK_MapData, KeyOfEn, selecedval);

        }
        function clickEnable(obj, FK_MapData, KeyOfEn, AtPara) {
            var selectVal = $(obj).val();
            cleanAll();
            if (AtPara.indexOf('@IsEnableJS=1') >= 0)
                setEnable(FK_MapData, KeyOfEn, selectVal);
        }
        //启用了显示与隐藏.
        function setEnable(FK_MapData, KeyOfEn, selectVal) {
            var pkval = FK_MapData + "_" + KeyOfEn + "_" + selectVal;
            var frmRB = new Entity("BP.Sys.FrmRB", pkval);


            //解决字段隐藏显示.
            var cfgs = frmRB.FieldsCfg;

            //@Title=3@OID=2@RDT=1@FID=3@CDT=2@Rec=1@Emps=3@FK_Dept=2@FK_NY=3
            if (cfgs) {

                var strs = cfgs.split('@');

                for (var i = 0; i < strs.length; i++) {

                    var str = strs[i];
                    var kv = str.split('=');

                    var key = kv[0];
                    var sta = kv[1];

                    if (sta == 0)
                        continue; //什么都不设置.


                    if (sta == 1) {  //要设置为可编辑.
                        SetCtrlShow(key);
                        SetCtrlEnable(key);
                    }

                    if (sta == 2) { //要设置为不可编辑.
                        SetCtrlShow(key);
                        SetCtrlUnEnable(key);
                        mapAttrs.push(key);
                    }

                    if (sta == 3) { //不可见.
                        SetCtrlHidden(key);
                        mapAttrs.push(key);
                    }

                }


            }

            //解决为其他字段设置值.
            var setVal = frmRB.SetVal;
            if (setVal) {
                var strs = setVal.split('@');

                for (var i = 0; i < strs.length; i++) {

                    var str = strs[i];
                    var kv = str.split('=');

                    var key = kv[0];
                    var value = kv[1];
                    SetCtrlVal(key, value);
                    mapAttrs.push(key);

                }
            }
        }

        //设置是否可以用?
        function SetCtrlEnable(key) {

            var ctrl = $("#TB_" + key);
            if (ctrl.length > 0) {
                ctrl.removeAttr("readonly");
            }

            ctrl = $("#DDL_" + key);
            if (ctrl.length > 0) {
                ctrl.removeAttr("disabled");
            }

            ctrl = $("#CB_" + key);
            if (ctrl.length > 0) {
                ctrl.removeAttr("disabled");
            }

            ctr = document.getElementsByName('RB_' + key);
            if (ctrl != null) {
                var ses = new Entities("BP.Sys.SysEnums");
                ses.Retrieve("EnumKey", key);
                for (var i = 0; i < ses.length; i++)
                    $("#RB_" + key + "_" + ses[i].IntKey).removeAttr("disabled");
            }
        }
        function SetCtrlUnEnable(key) {

            var ctrl = $("#TB_" + key);
            if (ctrl.length > 0) {
                ctrl.attr("readonly", "true");
            }

            ctrl = $("#DDL_" + key);
            if (ctrl.length > 0) {
                ctrl.attr("disabled", "disabled");
            }

            ctrl = $("#CB_" + key);
            if (ctrl.length > 0) {

                ctrl.attr("disabled", "disabled");
            }

            ctrl = $("#RB_" + key);
            if (ctrl != null) {
                $('input[name=RB_' + key + ']').attr("disabled", "disabled");
                //ctrl.attr("disabled", "disabled");
            }
        }
        //设置隐藏?
        function SetCtrlHidden(key) {

            var ctrl = $("#DIV_" + key);
            if (ctrl.length > 0) {
                ctrl.hide();
            }

        }
        //设置显示?
        function SetCtrlShow(key) {

            var ctrl = $("#DIV_" + key);
            if (ctrl.length > 0) {
                ctrl.show();
            }

        }

        //设置值?
        function SetCtrlVal(key, value) {
            var ctrl = $("#TB_" + key);
            if (ctrl.length > 0) {
                ctrl.val(value);
            }

            ctrl = $("#DDL_" + key);
            if (ctrl.length > 0) {
                ctrl.val(value);
            }

            ctrl = $("#CB_" + key);
            if (ctrl.length > 0) {
                ctrl.val(value);
            }

            ctrl = $("#RB_" + key + "_" + value);
            if (ctrl.length > 0) {
                ctrl.val(value);
                ctrl.attr('checked', true);
            }
        }

        //清空值?
        function CleanCtrlVal(key) {
            var ctrl = $("#TB_" + key);
            if (ctrl.length > 0) {
                ctrl.val('');
            }

            ctrl = $("#DDL_" + key);
            if (ctrl.length > 0) {
                ctrl.val('');
            }

            ctrl = $("#CB_" + key);
            if (ctrl.length > 0) {
                ctrl.val('');
            }

            ctrl = $("#RB_" + key);
            if (ctrl.length > 0) {
                ctrl.val('');
            }
        }
        //清空所有的设置
        function cleanAll() {
            for (var i = 0; i < mapAttrs.length; i++) {
                SetCtrlShow(mapAttrs[i]);
                SetCtrlEnable(mapAttrs[i]);
                CleanCtrlVal(mapAttrs[i]);
            }

        }

        function GenerGroupContext(groupEn, data, tableCol) {


            switch (groupEn.CtrlType) {

                case "Ath":
                    if (groupEn.CtrlID == "")
                        return "";
                    var athEn = $.grep(data.Sys_FrmAttachment, function (ath) { return ath.MyPK == groupEn.CtrlID });

                    if (athEn.length == 0) {
                        return "<tr><td colspan=" + tableCol + " style='width:100%;height:200px;' > 附件[" + groupEn.CtrlID + "]丢失</td></tr>";
                    }
                    if (athEn[0].IsVisable == "0")
                        return "";

                    var src = "../../CCForm/Ath.htm?PKVal=0&FK_MapData=" + pageData.fk_mapdata + "&FK_FrmAttachment=" + athEn[0].MyPK + "&IsReadonly=1";

                    var frameUrl = "<iframe ID='F" + athEn[0].MyPK + "' frameborder=0 style='padding:0px;border:0px;width:100%;height:" + athEn[0].H + "px;'  leftMargin='0'  topMargin='0' src='" + src + "'  scrolling='auto'  /></iframe>";
                    return "<tr><td colspan=" + tableCol + " id='TD" + athEn[0].MyPK + "' style='width:" + athEn[0].H + "px;'>" + frameUrl + "</td></tr>";

                    break;
                case "SubFlow":

                    var flowNo = GetQueryString("FK_Flow");
                    var nodeID = GetQueryString("FK_Node");

                    var src = "../../WorkOpt/SubFlow.htm?WorkID=0&FK_Flow=" + flowNo + "&FK_Node=" + nodeID;

                    var compent = new Entity("BP.WF.Template.FrmSubFlow", nodeID);

                    var frameDocs = "<iframe ID='F_SubFlow_" + nodeID + "' frameborder=0 style='padding:0px;border:0px;width:100%;height:" + compent.SF_H + "px;'  leftMargin='0'  topMargin='0' src='" + src + "'  scrolling='auto'  /></iframe>";
                    return "<tr><td colspan=" + tableCol + " id='SubFlow" + nodeID + "' style='width:300px;'>" + frameDocs + "</td></tr>";

                    break;
                case "Frame":
                    var frameEn = $.grep(data.Sys_MapFrame, function (frame) { return frame.MyPK == groupEn.CtrlID });
                    if (frameEn.length == 0) {
                        return "<tr><td colspan=" + tableCol + " style='width:100%;height:200px;' > 框架[" + groupEn.CtrlID + "]丢失</td></tr>";
                    }

                    var src = frameEn[0].URL;
                    if (src.indexOf('?') == -1)
                        src = frameEn[0].URL + "?PKVal=0&FK_MapData=" + pageData.fk_mapdata + "&MapFrame=" + frameEn[0].MyPK;
                    else
                        src = frameEn[0].URL + "&PKVal=0&FK_MapData=" + pageData.fk_mapdata + "&MapFrame=" + frameEn[0].MyPK;

                    var frameUrl = "<iframe ID='F" + frameEn[0].MyPK + "' frameborder=0 style='padding:0px;border:0px;width:100%;height:" + frameEn[0].H + "px;'  leftMargin='0'  topMargin='0' src='" + src + "'  scrolling='auto'  /></iframe>";
                    return "<tr><td colspan=" + tableCol + " id='TD" + frameEn[0].MyPK + "' style='width:" + frameEn[0].H + "px;'>" + frameUrl + "</td></tr>";

                    break;
                case "FWC":
                    return "<tr><td colspan=" + tableCol + " style='width:100%;' ><div id='WorkCheck'></div></td></tr>";
                case "Dtl":

                    var dtl = $.grep(data.Sys_MapDtl, function (dtl) { return dtl.No == groupEn.CtrlID });

                    if (dtl.length == 1) {
                        var src = "MapDtlDe.htm?DoType=Edit&FK_MapData=" + pageData.fk_mapdata + "&FK_MapDtl=" + dtl[0].No;
                        var frameUrl = "<iframe ID='F" + dtl[0].No + "' frameborder=0 style='padding:0px;border:0px;width:100%;height:" + dtl[0].H + "px;'  leftMargin='0'  topMargin='0' src='" + src + "'  scrolling='auto'  /></iframe>";
                        return "<tr><td colspan=" + tableCol + " id='TD" + dtl[0].No + "'>" + frameUrl + "</td></tr>";
                    } else {
                        html = "<tr><td colspan=" + tableCol + " style='width:100%;height:200px;' > 从表[" + groupEn.CtrlID + "]丢失</td></tr>";
                        return html;
                    }
                    break;
                default:
                    return "";
            }

            return html;
        }

        function GenerGroupTR(groupEn, tabCol, data) {

            var lab = groupEn.Lab;
            if (lab == "")
                lab = "编辑";

            //左边的按钮.
            var leftBtn = "<div style='text-align:left; float:left'>";

            var midBtn = "";
            var isShow = true;
            switch (groupEn.CtrlType) {
                case "Ath":
                    if (groupEn.CtrlID == "") {
                        isShow = false;
                        break;
                    }
                    //创建附件描述信息.
                    var frmattachments = data.Sys_FrmAttachment;
                    var ath = null;
                    for (var i = 0; i < frmattachments.length; i++) {
                        if (frmattachments[i].MyPK == groupEn.CtrlID) {
                            ath = frmattachments[i];
                            break;
                        }

                    }
                    if (ath == null) {
                        isShow = false;
                        break;
                    }
                    if (ath.IsVisable == "0") {
                        //如果是节点字段附件的时候就隐藏
                        var mapAttr = $.grep(data.Sys_MapAttr, function (obj, i) {
                            if (obj.MyPK == groupEn.CtrlID)
                                return obj;
                        });
                        if (mapAttr.length != 0) {
                            isShow = false;
                            break;
                        }
                    }
                    leftBtn += "<a href=\"javascript:EditAth('" + groupEn.CtrlID + "')\" >附件:" + lab + "</a>";
                    break;
                case "Frame":
                    leftBtn += "<a href=\"javascript:EditFrame('" + groupEn.CtrlID + "')\" >" + lab + "</a>";
                    break;
                case "SubFlow":
                    leftBtn += "<a href=\"javascript:EditSubFlow('" + groupEn.CtrlID + "')\" >" + lab + "</a>";
                    break;
                case "Dtl":

                    leftBtn += "<a href=\"javascript:EditDtl('" + groupEn.CtrlID + "')\" >从表属性:" + lab + "</a>";

                    //中间连接.
                    midBtn = "";
                    midBtn += '<a href="javascript:AddFForDtl(\'' + groupEn.CtrlID + '\');"><img src="../../Img/Btn/New.gif" border="0/">插入列</a>';
                    //midBtn += '<a href="javascript:document.getElementById(\'F' + groupEn.CtrlID + '\').contentWindow.AddFGroup(\'' + groupEn.CtrlID + '\');"><img src="../../Img/Btn/New.gif" border="0/">插入列组</a>';
                    //midBtn += '<a href="javascript:document.getElementById(\'F'+ groupEn.CtrlID + '\').contentWindow.CopyF(\'' +  groupEn.CtrlID + '\');"><img src="../../Img/Btn/Copy.gif" border="0/">复制列</a>';
                    midBtn += "";

                    break;
                case "FWC":
                    leftBtn += "<a href=\"javascript:FrmNodeComponent()\" >审核审批</a>";
                    break;
                default:
                    leftBtn += "<a href=\"javascript:GroupField('" + groupEn.EnName + "','" + groupEn.OID + "')\" >" + lab + "</a>";
                    break;
            }
            if (isShow == true) {
                leftBtn += "</div>";


                //右边的按钮都一样.
                var rightBtn = "<div class='cs-order'>" + midBtn;
                rightBtn += "<a href=\"javascript:GFDoUp('" + groupEn.OID + "' )\"  class='easyui-linkbutton l-btn l-btn-plain'  data-options='iconCls:icon-up,plain:true' ><span class='l-btn-left'><span class='l-btn-text'><span class='l-btn-empty icon-up'>&nbsp;</span></span></span></a>";
                rightBtn += "<a href=\"javascript:GFDoDown('" + groupEn.OID + "');\" class='easyui-linkbutton l-btn l-btn-plain' data-options='iconCls:icon-down,plain:true'><span class='l-btn-left'><span class='l-btn-text'><span class='l-btn-empty icon-down'>&nbsp;</span></span></span></a>";
                rightBtn += "</div>";

                var html = "<tr>";
                html += "<th colspan=" + tabCol + ">";


                html += leftBtn + rightBtn;

                html += "</th>";
                html += "</tr>";
            }

            return html;
        }

        function GenerLabel(attr) {

            var fk_mapdata = GetQueryString("FK_MapData");

            var tdUp = "<a href=\"javascript:Up('" + attr.MyPK + "','1');\" class='easyui-linkbutton l-btn l-btn-plain' data-options='iconCls:icon-left,plain:true'  alt='向左动顺序' ><span class='l-btn-left'><span class='l-btn-text'><span class='l-btn-empty icon-left'>&nbsp;</span></span></span></a>";
            var tdDown = "<a href=\"javascript:Down('" + attr.MyPK + "','1');\" class='easyui-linkbutton l-btn l-btn-plain' data-options='iconCls:icon-right,plain:true' alt='向右动顺序' ><span class='l-btn-left'><span class='l-btn-text'><span class='l-btn-empty icon-right'>&nbsp;</span></span></span></a>";

            if (attr.LGType == 0 && attr.UIContralType == 1) {
                return tdUp + "<a href=\"javascript:EditTableSQL('" + attr.MyPK + "','" + attr.KeyOfEn + "');\" > " + attr.Name + "</a>" + tdDown;
            }

            if (attr.LGType == 0) {
                return tdUp + "<a href=\"javascript:Edit('" + attr.MyPK + "','" + attr.MyDataType + "','" + attr.GroupID + "','" + attr.LGType + "','" + attr.UIContralType + "');\" > " + attr.Name + "</a>" + tdDown;
            }

            if (attr.LGType == 1)
                return tdUp + "<a href=\"javascript:EditEnum('" + attr.FK_MapData + "','" + attr.MyPK + "','" + attr.KeyOfEn + "');\" > " + attr.Name + "</a>" + tdDown;

            if (attr.LGType == 2)
                return tdUp + "<a href=\"javascript:EditTable('" + attr.FK_MapData + "','" + attr.MyPK + "','" + attr.KeyOfEn + "');\" > " + attr.Name + "</a>" + tdDown;
        }

        function AddFForDtl(fk_mapdtl) {

            var url = 'FieldTypeList.htm?FK_MapData=' + fk_mapdtl + '&inlayer=1&s=' + Math.random();
            OpenEasyUiDialog(url, "eudlgframe", "插入列", 800, 500, "icon-edit", true, null, null, null, function () {

                var frm = document.getElementById("F" + fk_mapdtl);
                frm.src = frm.src;

                // window.location.href = window.location.href;
                //ReloadDtlFrame();
            });
        }


    </script>
    <script language="javascript" type="text/javascript">

        function ReLoad(data) {
            window.location.href = window.location.href;
        }

        function FrmEvent(mypk) {

            if (mypk == null || mypk == "undefined")
                mypk = GetQueryString("FK_Node");

            var url = 'FrmEvent.htm?FK_MapData=' + mypk;
            var b = window.showModalDialog(url, 'ass', 'dialogHeight: 500px; dialogWidth: 700px;center: yes; help: no');
        }

        function Insert(mypk, IDX) {
            var url = 'FieldTypeList.htm?DoType=AddF&MyPK=' + mypk + '&IDX=' + IDX;
            var b = window.showModalDialog(url, 'ass', 'dialogHeight: 500px; dialogWidth: 700px;center: yes; help: no');
            window.location.href = window.location.href;
        }
        function BatchAddF() {
            var url = 'FieldTypeListBatch.htm?DoType=BatchAddF&FK_MapData=' + pageData.fk_mapdata;

            var h = 800;
            var w = 1000;
            var l = (screen.width - w) / 2;
            var t = (screen.height - h) / 2;
            var s = 'width=' + w + ', height=' + h + ', top=' + t + ', left=' + l;
            s += ', toolbar=no, scrollbars=no, menubar=no, location=no, resizable=no';
            OpenEasyUiDialog(url, "eudlgframe", '批量修改字段', 900, 450, "icon-edit", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }
        function AddF() {

            //var url = 'Do.htm?DoType=AddF&MyPK=' + mypk;
            var url = 'FieldTypeList.htm?DoType=AddF&FK_MapData=' + pageData.fk_mapdata;

            var h = 500;
            var w = 600;
            var l = (screen.width - w) / 2;
            var t = (screen.height - h) / 2;
            var s = 'width=' + w + ', height=' + h + ', top=' + t + ', left=' + l;
            s += ', toolbar=no, scrollbars=no, menubar=no, location=no, resizable=no';

            OpenEasyUiDialog(url, "eudlgframe", '增加字段', 800, 500, "icon-edit", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }
        function AddField(groupID) {

            if (mypk == null || mypk == "undefined")
                mypk = GetQueryString("FK_Node");

            var url = 'FieldTypeList.htm?DoType=AddF&FK_MapData=' + pageData.fk_mapdata + '&GroupField=' + groupID;

            OpenEasyUiDialog(url, "eudlgframe", '增加字段', 800, 500, "icon-edit", true, null, null, null, function () {
                window.location.href = window.location.href;
            });

        }
        function AddTable(mypk) {

            if (mypk == null || mypk == "undefined")
                mypk = GetQueryString("FK_Node");


            var url = 'EditCells.htm?MyPK=' + mypk;

            OpenEasyUiDialog(url, "eudlgframe", '新建', 800, 500, "icon-edit", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }

        function BatchEdit(mypk) {

            if (mypk == null || mypk == "undefined")
                mypk = GetQueryString("FK_Node");

            var url = 'BatchEdit.htm?FK_MapData=' + mypk;

            OpenEasyUiDialog(url, "eudlgframe", '批处理', 800, 500, "icon-property", true, null, null, null, function () {
                window.location.href = window.location.href;

            });
        }

        function CopyFieldFromNode(mypk) {

            if (mypk == null || mypk == "undefined")
                mypk = GetQueryString("FK_Node");

            var url = 'CopyFieldFromNode.htm?DoType=AddF&FK_Node=' + mypk;

            OpenEasyUiDialog(url, "eudlgframe", '复制', 800, 500, "icon-edit", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }

        /* 审核组件模式 */
        function GroupFieldFWCNew() {

            var mapData = new Entity("BP.Sys.MapData", GetQueryString("FK_MapData"));
            var val = prompt('请输入分组名称,比如:' + mapData.Name, mapData.Name);
            if (val == null || val == undefined)
                return;

            //转化为默认的拼音.
            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_CCFormDesigner_DialogCtr");
            handler.AddPara("name", val);
            handler.AddPara("flag", "0");
            var defVal = handler.DoMethodReturnString("FrmTextBox_ParseStringToPinyin");

            if (defVal == '' || defVal == null)
                defVal = "";

            var msg = "请输入分组前缀，比如您输入:" + defVal;
            msg += "\t\n系统就会自动创建,如下三个审核字段到数据库里,并且设置了默认值.";
            msg += "\t\n" + defVal + "_Checker审核人";
            msg += "\t\n" + defVal + "_RDT 审核日期";
            msg += "\t\n" + defVal + "_Note 审核意见";

            var prix = prompt(msg, defVal);
            if (prix == null || prix == undefined)
                return;

            //秦 18.11.16
            if (!CheckID(prix)) {
                alert("编号不符合规则");
                return;
            }

            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner");
            handler.AddPara("TB_Check_Name", val);
            handler.AddPara("TB_Check_No", prix);
            handler.AddPara("FK_MapData", GetQueryString("FK_MapData"));

            var data = handler.DoMethodReturnString("GroupField_SaveCheck");
            alert(data);
            window.location.href = window.location.href;
        }

        function GroupFieldNew() {

            var mapData = new Entity("BP.Sys.MapData", GetQueryString("FK_MapData"));
            var val = prompt('请输入分组名称:', mapData.Name);
            if (val == null || val == undefined)
                return;

            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner");

            handler.AddPara("FK_MapData", GetQueryString("FK_MapData"));
            handler.AddPara("EnName", GetQueryString("FK_MapData"));
            handler.AddPara("Lab", val);

            var data = handler.DoMethodReturnString("GroupField_Create");
            alert(data);

            window.location.href = window.location.href;
            return;


            var url = 'GroupField.htm?FK_MapData=' + GetQueryString("FK_MapData") + "&RefOID=0&DoType=FunList";
            OpenEasyUiDialog(url, "eudlgframe", '新建分组', 600, 500, "icon-property", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }
        function ExpImp() {

            var url = './ImpExp/Imp.htm?FK_MapData=' + pageData.fk_mapdata + "&DoType=FunList&FK_Flow=" + GetQueryString("FK_Flow") + "&FK_Node=" + GetQueryString("FK_Node");

            OpenEasyUiDialog(url, "eudlgframe", '导入导出', 800, 500, "icon-edit", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }
        function ShowNew() {
            $(".NewChild").fadeToggle("slow");

        }
        function GroupField(mypk, OID) {

            var url = "../../Comm/En.htm?EnName=BP.Sys.GroupField&PKVal=" + OID;

            OpenEasyUiDialog(url, "eudlgframe", '分组', 800, 500, "icon-property", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }
        function EditBigText(mypk, frmID) {
            url = './EditFExtContral/60.BigNoteHtmlText.htm?FrmID=' + frmID + '&MyPK=' + mypk;
            OpenEasyUiDialog(url, "eudlgframe", "大文本编辑", 800, 500, "icon-edit", true, null, null, null, function () {
                window.location.href = window.location.href;

            });


        }
        function Edit(mypk, ftype, gf, fk_mapdtl, uiContralType) {

            var url = 'EditF.htm?DoType=Edit&MyPK=' + mypk + '&FType=' + ftype + '&FK_MapData=' + pageData.fk_mapdata + '&GroupField=' + gf;
            var title = '';
            if (ftype == 1) {


                if (uiContralType == 0) {
                    title = '字段String属性';
                    url = '../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrString&PKVal=' + mypk + '&s=' + Math.random();
                }

                if (uiContralType == 9) {
                    title = '字段String超连接';
                    url = '../../Comm/EnOnly.htm?EnName=BP.Sys.FrmUI.ExtLink&PKVal=' + mypk + '&s=' + Math.random();
                }

                if (uiContralType == 8) {
                    title = '手写签名版';
                    url = '../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrString&PKVal=' + mypk + '&s=' + Math.random();
                }

                if (uiContralType == 6) {
                    title = '附件组件';
                    url = '../../Comm/En.htm?EnName=BP.Sys.FrmUI.FrmAttachmentExt&PKVal=' + mypk + '&s=' + Math.random();
                }

                if (uiContralType == 11) {

                    var imgEn = new Entity("BP.Sys.FrmUI.ExtImg");
                    imgEn.SetPKVal(mypk);

                    if (imgEn.RetrieveFromDBSources() == 0) {
                        var mapAttr = new Entity("BP.Sys.MapAttr", mypk);

                        imgEn.CopyJSON(mapAttr);
                        imgEn.MyPK = mypk;
                        imgEn.Insert();
                    }

                    title = '装饰类图片属性';
                    url = '../../Comm/EnOnly.htm?EnName=BP.Sys.FrmUI.ExtImg&PKVal=' + mypk + '&s=' + Math.random();
                }

                if (uiContralType == 12) {
                    title = '图片附件';
                    url = '../../Comm/EnOnly.htm?EnName=BP.Sys.FrmUI.FrmImgAth&PKVal=' + mypk + '&s=' + Math.random();
                }

                if (uiContralType == 13) {
                    title = '证件字段属性';
                    url = '../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrCard&PKVal=' + mypk + '&s=' + Math.random();
                }
                if (uiContralType == 14) {
                    title = '签批组件';
                    url = '../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrCheck&PKVal=' + mypk + '&s=' + Math.random();
                }
                if (uiContralType == 15) {
                    title = '评论组件';
                    url = '../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrFlowBBS&PKVal=' + mypk + '&s=' + Math.random();
                }

                if (uiContralType == 16) {
                    title = '系统定位属性';
                    url = '../../Comm/EnOnly.htm?EnName=BP.Sys.FrmUI.MapAttrFixed&PKVal=' + mypk + '&s=' + Math.random();
                }

                if (uiContralType == 17) {
                    title = '发文字号属性';
                    url = '../../Comm/EnOnly.htm?EnName=BP.Sys.FrmUI.MapAttrDocWord&PKVal=' + mypk + '&s=' + Math.random();
                }

                if (uiContralType == 170) {
                    title = '收文字号属性';
                    url = '../../Comm/EnOnly.htm?EnName=BP.Sys.FrmUI.MapAttrDocWordReceive&PKVal=' + mypk + '&s=' + Math.random();
                }

                if (uiContralType == 18) {
                    title = '按钮属性';
                    url = '../../Comm/EnOnly.htm?EnName=BP.Sys.FrmUI.FrmBtn&PKVal=' + mypk + '&s=' + Math.random();
                }

                if (uiContralType == 8) {
                    title = '书写签字版';
                    url = '../../Comm/EnOnly.htm?EnName=BP.Sys.FrmUI.ExtHandWriting&PKVal=' + mypk + '&s=' + Math.random();
                }
                if (uiContralType == 4) {
                    title = '地图';
                    url = '../../Comm/EnOnly.htm?EnName=BP.Sys.FrmUI.ExtMap&PKVal=' + mypk + '&s=' + Math.random();
                }
                if (uiContralType == 50) {
                    title = '流程进度图';
                    url = '../../Comm/EnOnly.htm?EnName=BP.WF.Template.ExtJobSchedule&PKVal=' + mypk + '&s=' + Math.random();
                }
                if (uiContralType == 101) {
                    title = '评分控件';
                    url = '../../Comm/EnOnly.htm?EnName=BP.Sys.FrmUI.ExtScore&PKVal=' + mypk + '&s=' + Math.random();
                }

            }

            if (ftype == 2 || ftype == 3 || ftype == 5 || ftype == 8) {
                title = '字段Num属性';
                url = '../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrNum&PKVal=' + mypk + '&s=' + Math.random();
            }

            if (ftype == 6 || ftype == 7) {
                title = '字段 date 属性';

                url = '../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrDT&PKVal=' + mypk + '&s=' + Math.random();
            }

            if (ftype == 6 || ftype == 7) {
                title = '字段 datetime 属性';

                url = '../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrDT&PKVal=' + mypk + '&s=' + Math.random();
            }

            if (ftype == 4) {
                title = '字段 boolen 属性';
                url = '../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrBoolen&PKVal=' + mypk + '&s=' + Math.random();
            }

            OpenEasyUiDialog(url, "eudlgframe", title, 800, 500, "icon-edit", true, null, null, null, function () {

                window.location.href = window.location.href;

            });

            // OpenEasyUiDialog(url, "dd", title, 730, 500);
            return;
        }

        function EditEnum(fk_mapdata, mypk, keyOfEn) {

            var url = '../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrEnum&PKVal=' + mypk + '&s=' + Math.random();

            OpenEasyUiDialog(url, "eudlgframe", '枚举' + keyOfEn + '属性', 730, 500, "icon-property", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }

        function EditTableSQL(mypk, keyOfEn) {

            var url = '../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrSFSQL&PKVal=' + mypk + '&s=' + Math.random();

            OpenEasyUiDialog(url, "eudlgframe", '外键SQL字段:' + keyOfEn + '属性', 730, 500, "icon-property", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }

        function EditTable(fk_mapData, mypk, keyOfEn) {

            var url = '../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrSFTable&PKVal=' + mypk + '&s=' + Math.random();

            OpenEasyUiDialog(url, "eudlgframe", '外键字段:' + keyOfEn + '属性', 730, 500, "icon-property", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }
        // 向上移动.
        function Up(mypk, idx, t) {

            var en = new Entity("BP.Sys.MapAttr", mypk);
            var data = en.DoMethodReturnString("DoUp");
            if (data.indexOf('err@') != -1)
                alert(data);
            window.location.href = window.location.href;
        }

        //向下移动.
        function Down(mypk, idx, t) {

            var en = new Entity("BP.Sys.MapAttr", mypk);
            var data = en.DoMethodReturnString("DoDown");
            if (data.indexOf('err@') != -1)
                alert(data);
            window.location.href = window.location.href;
        }


        function GFDoUp(refoid) {
            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner");
            handler.AddPara("RefOID", refoid);
            var data = handler.DoMethodReturnString("Designer_GFDoUp");
            ReLoad(data, this);

        }
        function GFDoDown(refoid) {
            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner");
            handler.AddPara("RefOID", refoid);
            var data = handler.DoMethodReturnString("Designer_GFDoDown");
            ReLoad(data, this);

        }

        function GroupBarClick(rowIdx) {

            var alt = document.getElementById('Img' + rowIdx).alert;
            var sta = 'block';
            if (alt == 'Max') {
                sta = 'block';
                alt = 'Min';
            } else {
                sta = 'none';
                alt = 'Max';
            }

            document.getElementById('Img' + rowIdx).src = './Img/' + alt + '.gif';
            document.getElementById('Img' + rowIdx).alert = alt;
            var i = 0
            for (i = 0; i <= 40; i++) {
                if (document.getElementById(rowIdx + '_' + i) == null)
                    continue;
                if (sta == 'block') {
                    document.getElementById(rowIdx + '_' + i).style.display = '';
                } else {
                    document.getElementById(rowIdx + '_' + i).style.display = sta;
                }
            }
        }

        var isInser = "";

        function CopyFieldFromNode(mypk) {

            if (mypk == null || mypk == "undefined")
                mypk = GetQueryString("FK_Node");

            var url = 'CopyFieldFromNode.htm?FK_Node=' + mypk;

            OpenEasyUiDialog(url, "eudlgframe", '复制', 730, 900, "icon-property", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }

        // 子线程.
        function EditFrmThread(mypk) {

            if (mypk == null || mypk == "undefined")
                mypk = GetQueryString("FK_Node");

            var url = '../../Comm/En.htm?EnName=BP.WF.Template.FrmTrack&PKVal=' + mypk;

            OpenEasyUiDialog(url, "eudlgframe", '子线程', 400, 700, "icon-property", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }

        // 轨迹图.
        function EditTrack(mypk) {

            if (mypk == null || mypk == "undefined")
                mypk = GetQueryString("FK_Node");

            var url = '../../Comm/En.htm?EnName=BP.WF.Template.FrmTrack&PKVal=' + mypk;

            OpenEasyUiDialog(url, "eudlgframe", '轨迹图', 400, 700, "icon-property", true, null, null, null, function () {
                window.location.href = window.location.href;
            });

        }


        /// 审核组件.
        function EditFWC(mypk) {

            if (mypk == null || mypk == "undefined")
                mypk = GetQueryString("FK_Node");

            var url = '../../Comm/EnOnly.htm?EnName=BP.WF.Template.FrmNodeComponent&PK=' + mypk + '&tab=审核组件';

            OpenEasyUiDialog(url, "eudlgframe", '组件', 400, 700, "icon-property", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }
        //子流程.
        function EditSubFlow(mypk) {

            mypk = GetQueryString("FK_Node");

            var url = '../../Comm/En.htm?EnName=BP.WF.Template.FrmSubFlow&PKVal=' + mypk + '&tab=父子流程组件';

            OpenEasyUiDialog(url, "eudlgframe", '组件', 900, 500, "icon-property", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }

        //子线程.
        function EditThread(mypk) {
            if (mypk == null || mypk == "undefined")
                mypk = GetQueryString("FK_Node");

            // var url = '../Comm/En.htm?EnName=BP.WF.Template.FrmSubFlow&PK=' + mypk
            var url = '../../Comm/EnOnly.htm?EnName=BP.WF.Template.FrmNodeComponent&PKVal=' + mypk + '&tab=子线程组件';

            OpenEasyUiDialog(url, "eudlgframe", '组件', 400, 700, "icon-property", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }

        //流转自定义.
        function EditFTC(mypk) {

            if (mypk == null || mypk == "undefined")
                mypk = GetQueryString("FK_Node");
            var url = '../../Comm/EnOnly.htm?EnName=BP.WF.Template.FrmNodeComponent&PKVal=' + mypk + '&tab=流转自定义';

            OpenEasyUiDialog(url, "eudlgframe", '组件', 400, 700, "icon-property", true, null, null, null, function () {
                window.location.href = window.location.href;
            });

        }

        //轨迹组件.
        function EditTrack(mypk) {

            if (mypk == null || mypk == "undefined")
                mypk = GetQueryString("FK_Node");


            var url = '../../Comm/EnOnly.htm?EnName=BP.WF.Template.FrmNodeComponent&PKVal=' + mypk + '&tab=轨迹组件';


            OpenEasyUiDialog(url, "eudlgframe", '组件', 400, 700, "icon-property", true, null, null, null, function () {
                window.location.href = window.location.href;
            });

        }

        function MapDataEdit() {

            var url = '../../Comm/En.htm?EnName=BP.WF.Template.MapFrmFool&PKVal=' + GetQueryString("FK_MapData");

            //获取页面的大小
            var W = document.body.clientWidth - 80;
            var H = document.body.clientHeight - 80;
            OpenEasyUiDialog(url, "eudlgframe", '属性', W, H, "icon-property", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }

        function FrmNodeComponent(mypk) {

            if (mypk == null || mypk == "undefined")
                mypk = GetQueryString("FK_Node");

            if (mypk == null || mypk == undefined) {
                alert('非节点表单');
                return;
            }

            var url = '../../Comm/EnOnly.htm?EnName=BP.WF.Template.FrmNodeComponent&PKVal=' + mypk;
            OpenEasyUiDialog(url, "eudlgframe", '组件', 800, 550, "icon-property", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }

        function MobileFrm() {
            var url = '../AttrNode/SortingMapAttrs.htm?FK_Flow=' + GetQueryString("FK_Flow") + '&FK_Node=' + GetQueryString('FK_Node') + '&FK_MapData=' + GetQueryString("FK_MapData");

            OpenEasyUiDialog(url, "eudlgframe", '组件', 800, 550, "icon-property", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }



        //新增从表.
        function NewMapDtl() {

            var val = prompt('请输入从表ID，要求表单唯一。', pageData.fk_mapdata + 'Dtl1');

            if (val == null) {
                return;
            }

            //秦 18.11.16
            if (!CheckID(val)) {
                alert("编号不符合规则");
                return;
            }

            if (val == '') {
                alert('请输入从表ID不能为空，请重新输入！');
                NewMapDtl(pageData.fk_mapdata);
                return;
            }
            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner");
            handler.AddPara("FK_MapData", pageData.fk_mapdata);
            handler.AddPara("DtlNo", val);
            handler.AddPara("FK_Node", 0); //从表为原始属性的时候FK_Node=0,设置从表权限的时候FK_Node为该节点的值

            var data = handler.DoMethodReturnString("Designer_NewMapDtl");

            if (data.indexOf('err@') == 0) {
                alert(data);
                return;
            }

            var url = '../../Comm/En.htm?EnName=BP.WF.Template.MapDtlExt&FK_MapData=' + pageData.fk_mapdata + '&No=' + data;
            OpenEasyUiDialog(url, "eudlgframe", '从表属性', 800, 500, "icon-edit", true, null, null, null, function () {
                window.location.href = window.location.href;
            });

            return;
        }


        ///编辑从表.
        function EditDtl(mypk) {
            var url = '../../Comm/En.htm?EnName=BP.WF.Template.MapDtlExt&FK_MapData=' + pageData.fk_mapdata + '&No=' + mypk;

            OpenEasyUiDialog(url, "eudlgframe", '从表', 950, 600, "icon-edit", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }

        function EditM2M(dtlKey) {
            var url = 'MapM2M.htm?DoType=Edit&FK_MapData=' + pageData.fk_mapdata + '&NoOfObj=' + dtlKey;
            // OpenEasyUiDialog(url, 'dtl', '属性', 800, 500, "icon-edit");
        }


        /// 多选.
        function MapM2M() {
            var url = 'MapM2M.htm?DoType=List&FK_MapData=' + pageData.fk_mapdata;

            OpenEasyUiDialog(url, "eudlgframe", '多选', 950, 600, "icon-edit", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }

        function MapM2MM() {
            var url = 'MapM2MM.htm?FK_MapData=' + pageData.fk_mapdata;

            OpenEasyUiDialog(url, "eudlgframe", '多选', 950, 600, "icon-edit", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }

        //修改附件.
        function EditAth(ath) {
            var url = '../../Comm/En.htm?EnName=BP.Sys.FrmUI.FrmAttachmentExt&FK_MapData=' + pageData.fk_mapdata + '&MyPK=' + ath;

            OpenEasyUiDialog(url, "eudlgframe", '附件', 950, 600, "icon-edit", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }

        //新增附件.
        function NewAth() {

            var val = prompt('请输入附件ID:(要求是字母数字下划线，非中文等特殊字符.)', 'Ath1');
            if (val == null) {
                return;
            }

            if (val == '') {
                alert('附件ID不能为空，请重新输入！');
                return;
            }

            //秦 18.11.16
            if (!CheckID(val)) {
                alert("编号不符合规则");
                return;
            }

            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner");
            handler.AddPara("FK_MapData", GetQueryString("FK_MapData"));
            handler.AddPara("AthNo", val);
            var data = handler.DoMethodReturnString("Designer_AthNew");

            if (data.indexOf('err@') == 0) {
                alert(data);
                return;
            }

            var url = '../../Comm/En.htm?EnName=BP.Sys.FrmUI.FrmAttachmentExt&FK_MapData=' + pageData.fk_mapdata + '&MyPK=' + data;
            OpenEasyUiDialog(url, "eudlgframe", '附件', 800, 500, "icon-edit", true, null, null, null, function () {
                window.location.href = window.location.href;
            });

            return;
        }

        function NewFrame() {

            var alert = "\t\n1.为了更好的支持应用扩展,ccform可以用iFrame的地图、流程轨迹图、轨迹表的展示。";
            alert += "\t\n2.在创建一个框架后，在框架属性里设置。";
            alert += "\t\n3.请输入框架ID,要求是字母数字下划线，非中文等特殊字符。";

            var val = prompt('新建框架:' + alert, 'Frame1');

            if (val == null) {
                return;
            }

            if (val == '') {
                alert('框架ID不能为空，请重新输入！');
                NewFrame(pageData.fk_mapdata);
                return;
            }

            var en = new Entity("BP.Sys.FrmUI.MapFrameExt");
            en.MyPK = GetQueryString("FK_MapData") + "_" + val;
            if (en.IsExits() == true) {
                alert("该编号[" + val + "]已经存在");
                return;
            }

            en.FK_MapData = GetQueryString("FK_MapData");
            en.Name = "我的框架" + val;
            en.FrameURL = 'MapFrameDefPage.htm';
            en.H = 200;
            en.W = 200;
            en.X = 100;
            en.Y = 100;
            en.Insert();

            var url = '../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapFrameExt&FK_MapData=' + pageData.fk_mapdata + '&MyPK=' + en.MyPK;
            OpenEasyUiDialog(url, "eudlgframe", '框架', 900, 400, "icon-property", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
            return;
        }

        function EditFrame(myPK) {
            var url = '../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapFrameExt&FK_MapData=' + pageData.fk_mapdata + '&MyPK=' + myPK;
            OpenEasyUiDialog(url, "eudlgframe", '框架', 900, 400, "icon-property", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }

        function MapFrame() {
            var url = 'MapFrame.htm?FK_MapData=' + pageData.fk_mapdata;

            OpenEasyUiDialog(url, "eudlgframe", '框架', 800, 500, "icon-property", true, null, null, null, function () {
                window.location.href = window.location.href;
            });
        }

        function HidAttr() {
            var url = 'HidAttr.htm?FK_MapData=' + pageData.fk_mapdata;

            OpenEasyUiDialog(url, "eudlgframe", '隐藏字段', 800, 500, "icon-property", true, null, null, null, function () {
                window.location.href = window.location.href;
            });

            // var b = window.showModalDialog(url, 'ass', 'dialogHeight: 500px; dialogWidth: 700px;center: yes; help: no');
            // window.location.href = window.location.href;
        }
        function EnableAthM() {
            var url = '../CCForm/Ath.htm?IsBTitle=1&PKVal=0&Ath=AthMDtl&FK_MapData=' + pageData.fk_mapdata + '&FK_FrmAttachment=' + pageData.fk_mapdata + '_AthMDtl';

            OpenEasyUiDialog(url, "eudlgframe", '多附件', 800, 500, "icon-property", true, null, null, null, function () {
                window.location.href = window.location.href;
            });

        }
        function Sln() {
            var url = 'Sln.htm?IsBTitle=1&PKVal=0&Ath=AthM&FK_MapData=' + pageData.fk_mapdata + '&FK_FrmAttachment=' + pageData.fk_mapdata + '_AthM';
            WinOpen(url);
        }

        function AddComponent() {
            var url = './Components/Default.htm?FK_MapData=' + pageData.fk_mapdata + "&FrmType=0";
            OpenEasyUiDialog(url, "eudlgframe", '新建组件', 800, 500, "icon-property", true, null, null, null, function () {
                window.location.href = window.location.href;
            });

        }

        function DropDown(el) {
            this.dd = el;
            this.initEvents();
        }
        DropDown.prototype = {
            initEvents: function () {
                var obj = this;

                obj.dd.on('click', function (event) {
                    $(this).toggleClass('active');
                    event.stopPropagation();
                });
            }
        }

        /*隐藏与显示.*/
        function ShowHidden(ctrlID) {

            var ctrl = document.getElementById(ctrlID);

            ctrl.style.display = 'block';

            document.onclick = function () {

                ctrl.style.display = "none";
            }
        }

        $(function () {

        });

    </script>
</head>
<body onkeypress="Esc();" class="easyui-layout layout panel-noscroll" topmargin="0" leftmargin="0">

    <div class="easyui-layout layout cs-easyui-layout" data-options="fit:true" style="width: 100%; height: 628px;">
        <div class="panel layout-panel layout-panel-north cs-panel-north">
            <div data-options="region:'north'" id="toolbar" style="padding: 0px;
        overflow-y: hidden;
" title="表单设计器-工具栏"
                 class="panel-body panel-body-noheader layout-body cs-btn-group">
                <a href="javascript:MapDataEdit();" class="easyui-linkbutton btn-light-green">
                    表单属性
                </a>


                <a href="javascript:ExpImp();" class="easyui-linkbutton btn-light-blue">
                    导入/导出
                </a>
                <input type="button" value="新建合集" id="Btn_Save" onmouseover="ShowHidden('state')" />
                <div id="state" style="margin-left:133px; width:150px;height:auto; position:fixed; z-index:10;display: none; color: Gray">
                    <ul>
                        <li>
                            <a href="javascript:AddF();" class="easyui-linkbutton btn-light-yellow">
                                新建字段
                            </a>
                        </li>
                        <li>
                            <a href="javascript:AddComponent();" class="easyui-linkbutton btn-light-yellow">
                                新建组件
                            </a>
                        </li>
                        <li>
                            <a href="javascript:GroupFieldNew();" class="easyui-linkbutton btn-light-green">
                                新建字段分组
                            </a>
                        </li>
                        <li>
                            <a href="javascript:GroupFieldFWCNew();" class="easyui-linkbutton btn-light-red">
                                新建审核分组
                            </a>
                        </li>
                        <li>
                            <a href="javascript:NewMapDtl();" class=" easyui-linkbutton btn-light-blue">
                                新建从表
                            </a>
                        </li>
                        <li>
                            <a href="javascript:NewAth();" class=" easyui-linkbutton btn-light-green">
                                新建附件
                            </a>
                        </li>
                        <li>
                            <a href="javascript:NewFrame();" class=" easyui-linkbutton btn-light-yellow">
                                新建框架
                            </a>
                        </li>

                    </ul>
                </div>
                <a href="javascript:BatchAddF();" class="easyui-linkbutton btn-light-red">
                    批量修改字段
                </a>
                <a href="javascript:FrmNodeComponent();" class="easyui-linkbutton btn-light-blue" id="FrmNodeComponent">节点表单组件</a>
                <!--<a href="javascript:MobileFrm();" class="easyui-linkbutton  btn-light-green">
                    手机表单
                </a>-->

            </div>
        </div>
        <div class="panel layout-panel layout-panel-center cs-panel-center">
            <div data-options="region:'center'" title="" class="panel-body panel-body-noheader layout-body cs-panel-body">

                <table id="contentTable" class="cs-table">
                </table>

            </div>
        </div>
    </div>
</body>
</html>
